#pragma once
#include <string>
#include <mutex>
using std::string;
using std::mutex;

enum LOG_LEVEL
{
    LOG_DEBUG = 0,
    LOG_INFO = 1,
    LOG_WARNING = 2,
    LOG_ERROR = 3,
    LOG_CRITICAL = 4
};

class onvifToolUtils
{
public:
    onvifToolUtils();
    void setLogToFile(int logLevel, char const *strLogDir, int autoDel);
    void setLogFileName(char const *fileName = nullptr, char const * strLogDir = nullptr);
    void log(string message, int logLevel = -1);
    static string getDate();
    static string getTime();
    static string generateUUID();
    static string prefixToSubmask(int len);
    static string toLower(string str);
    static bool compareServiceName(string serviceNameFind, string serviceName);
    static string time_tToDateTime(time_t timeVal);
    static time_t dateTimeToTime_t(string dateTimeVal);
    static string time_tToLocalTime(time_t timeVal);
    static time_t localTimeToTime_t(string localTimeVal);

private:
    int logLevel_;
    string logDir;
    string fileName_;
    FILE *logFile;
    mutex mutex_;
};